< previous page page_279 next page >

Page 279
like to know what's the current page and what's the current position on that page. This type of information, called status information, is usually displayed onscreen all the time rather than in a message box. In addition, users want to know how long a given task will take to accomplish and what part of the task is occurring at any given point in time. This type of information can be called progress information. In this section, you look at three of the common controls used for these purposes:
StatusBar, which displays status messages
ProgressBar, which provides a graphical representation of progress toward a goal
Animation, which allows you to display a ''movie" to let the users know your program is doing something
Before you can use any of these controls, you must add them to the Visual Basic Toolbox. For information on how to add controls, see the first section of this chapter, "Introduction to the Common Controls."
Adding a Status Bar to Your Program
Before the advent of the StatusBar control, Visual Basic programmers often used "fake" status bars made from panels and Label controls. They worked quite well (and still do today). However, the StatusBar control provides a simpler alternative. If you are already using one of the other Common controls from the same group, you don't have to worry about the extra overhead of distributing another because all of the controls in the group are included in the same OCX file, which you have to distribute anyway.
Figure 12.28 shows a typical status bar from a Visual Basic program.
0279-01.jpg
Figure 12.28
Status bars are usually positioned at the bottom of a form.
Creating a Status Bar
You create a status bar by first selecting the control and drawing it on your form. When it is first drawn, the status bar spans the width of its parent form and contains a single panel, as shown in Figure 12.29. Notice that no matter where on your form you draw the status bar, it automatically moves to the bottom of the form. This position is the typical location for a program's status bar.

 
< previous page page_279 next page >